import sqlite3
import numpy as np
import pandas as pd
import tushare as ts

ts.set_token('1e543ac9a7ac5d4d782bdabe51f647e507a05d2fa8fc29cb31cac550')
pro = ts.pro_api()

fundList = ['002974.of','004070.of','007301.of','']

def get_fund_daily_data(ts_code=''):
    df = pro.fund_nav(ts_code=ts_code)
    df.to_excel('D:/'+ts_code+'.xlsx')

def get_daily_data(ts_code='',adj='',start_date='',end_date=''):
    df = ts.pro_bar(ts_code=ts_code,adj=adj,start_date=start_date,end_date=end_date)
    print(df[['open','high','low','close','pre_close','pct_chg']])
    # df.to_excel('D:/'+ts_code+'.xlsx')


# get_daily_data('603636.SH','qfq','20200518','20200520')
get_daily_data('600446.SH','qfq','20200519','20200520')